package co.edu.javeriana.touresbalon.oms.webservices.clients.creditcard;

/**
 *
 * @author ada
 */
public class CreditCardClient {
    public boolean cargarTarjeta(Double mount, String number, String type){
        CreditCardEndpointService creditCardEndpointService=new CreditCardEndpointService();
        CreditCardService creditCardService=creditCardEndpointService.getCreditCardService();
        
        ChargeCreditCardElement request=new ChargeCreditCardElement();
        CreditCard creditCard=new CreditCard();
        creditCard.setMount(mount);
        creditCard.setNumber(number);
        creditCard.setType(type);
        
        request.setCc(creditCard);
        try {
            ChargeCreditCardResponseElement response= creditCardService.chargeCreditCard(request);
            return response.isResult();
        } catch (CreditCardValidationFaultMessageException ex) {
            return false;
        }
    }
}
